﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HustQQModel;

namespace HustQQInterface
{
    public interface IDataInterface
    {
        #region 注册登录
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="pwd">用户在界面输入的密码</param>
        /// <returns>返回是否登录成功</returns>
        bool Login(string userId, string pwd);
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="u">当前用户信息</param>
        /// <returns>用户注册到的Id号,通过随机产生</returns>
        string Register(User u);
        #endregion

        #region 好友管理
        /// <summary>
        /// 获取用户详细信息
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="isDetail">是否需要完整信息.-完整:所以字段都必须填充,查询自己的个人信息.-不完整:不包括密码等敏感信息,查询好友的个人信息.</param>
        /// <returns>用户详细信息</returns>
        User GetUserInformation(string userId,bool isDetail);
        /// <summary>
        /// 将好友加入用户的默认分组
        /// </summary>
        /// <param name="myId">当前用户id</param>
        /// <param name="friendId">好友id</param>
        /// <returns>加入好友是否成功</returns>
        bool AddFriendToUser(string myId,string friendId);
        /// <summary>
        /// 将好友加入分组
        /// </summary>
        /// <param name="myId">当前用户id</param>
        /// <param name="friendId">好友id</param>
        /// <param name="groupName">分组名称</param>
        /// <returns>加入分组是否成功</returns>
        bool AddFriendToGroup(string myId, string friendId, string groupName);
        /// <summary>
        /// 删除好友
        /// </summary>
        /// <param name="myId">当前用户id</param>
        /// <param name="friendId">好友id</param>
        /// <returns>是否删除成功</returns>
        bool DelFriendFromUser(string myId, string friendId);
        /// <summary>
        /// 从分组删除好友
        /// </summary>
        /// <param name="myId">当前用户id</param>
        /// <param name="friendId">好友id</param>
        /// <param name="groupName">分组名称</param>
        /// <returns>是否删除成功</returns>
        bool DelFriendFromGroup(string myId, string friendId, string groupName);
        #endregion

        #region 个人信息管理
        /// <summary>
        /// 修改个人信息
        /// </summary>
        /// <param name="u">当前用户详细信息</param>
        /// <returns>是否修改成功</returns>
        bool SetUserInformation(User u);
        #endregion

        #region 群组管理
        /// <summary>
        /// 获得一个人的所有群
        /// </summary>
        /// <param name="myId">当前用户Id</param>
        /// <returns>此用户的所有群的Id</returns>
        List<string> GetTeams(string myId);
        /// <summary>
        /// 新建群组
        /// </summary>
        /// <param name="myId">当前用户Id</param>
        /// <returns>用户得到的群组Id,通过随机数产生</returns>
        string NewTeamToUser(string myId, string teamName);
        /// <summary>
        /// 获取群组详细信息
        /// </summary>
        /// <param name="teamId">群组Id</param>
        /// <param name="isDetail">是否需要完整信息.-完整:将Team所有字段都填充满.-不完整:不填充team中userList</param>
        /// <returns>Team的详细信息</returns>
        Team GetTeamInformation(string teamId, bool isDetail);
        /// <summary>
        /// 设置Team的详细信息
        /// </summary>
        /// <param name="t">Team的详细信息</param>
        /// <returns>是否修改成功</returns>
        bool SetTeamInformation(Team t);
        /// <summary>
        /// 将好友加入群组
        /// </summary>
        /// <param name="teamId">群组Id</param>
        /// <param name="userId">用户Id</param>
        /// <returns>好友加入群组是否成功</returns>
        bool AddFriendToTeam(string teamId, string userId);
        /// <summary>
        /// 从群组删除好友
        /// </summary>
        /// <param name="teamId">群组Id</param>
        /// <param name="userId">用户Id</param>
        /// <returns>删除好友是否成功</returns>
        bool DelFriendFromTeam(string teamId, string userId);
        #endregion

        #region 网络链路管理
        /// <summary>
        /// 设置当前登录用户的Ip和端口
        /// </summary>
        /// <param name="userId">当前用户Id</param>
        /// <param name="ipPort">端口和Ip对</param>
        /// <returns>是否设置成功</returns>
        bool SetIpPort(string userId, IpPort ipPort);
        /// <summary>
        /// 获取好友的端口Ip对
        /// </summary>
        /// <param name="userId">好友Id</param>
        /// <returns>好友的端口和Ip</returns>
        IpPort GetIpPort(string userId);
        #endregion

    }
}
